const int switchPin = 2;  
const int motor1Pin = 3;  
const int motor2Pin = 4;  
const int enablePin = 9;  

void setup() {
    pinMode(switchPin, INPUT);
    pinMode(motor1Pin, OUTPUT);
    pinMode(motor2Pin, OUTPUT);
    pinMode(enablePin, OUTPUT);
    digitalWrite(enablePin, HIGH);
}

void loop() {
    if (digitalRead(switchPin) == HIGH) {
      digitalWrite(motor1Pin, LOW);   
      digitalWrite(motor2Pin, HIGH);
    } else {
      digitalWrite(motor1Pin, HIGH);  
      digitalWrite(motor2Pin, LOW);   
    }
}













 




